home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / source / picturemove.s < prev    next >
Text File  |  1993-08-09  |  36KB  |  1,767 lines

  1. rout            ;when this is off, the routine-file will be
  2.             ;assembled, on=testing
  3.             
  4. ;debug            ;when this is on, colors in the background will
  5.             ;show how much time the routine needs.
  6.  
  7.  
  8. routinemode    equ    67    ;the routinemode !
  9.  
  10.  
  11. ; the first part of the source handles the things that are necessary to
  12. ; show the picture/copper and playing of the routine.
  13. ; the part between the "***" lines is the routine-source.
  14. ; at the bottom of the file, there are the necessary incbin-files who
  15. ; are needed to test the routine.
  16. ; these are saved with "save effect" in videotracker. they are raw
  17. ; data files which can be fonts,pictures,landscapes,vectorobjects
  18. ; etcetra.
  19. ; the incbin-files are put in the "variables" table, in the routine-
  20. ; player-handler
  21. ; the place where it's done can be found by searching for "!!!"
  22.  
  23.  
  24.     opt    a+    ;devpac 3 optimize
  25.     opt    o+
  26.  
  27.     ifd    rout
  28.     
  29.     ;videotracker routine-test
  30.  
  31.     incdir    "videotracker:include/"
  32.     include    "exec/types.i"
  33.     include    "graphics/gfxbase.i"
  34.     include    "lvo/graphics_lib.i"
  35.     incdir    'videotracker:effect/'
  36.  
  37. vew_wid    equ    44
  38. vew_hgt    equ    290
  39. win_hgt    equ    117
  40. win_str    equ    $1a
  41.  
  42.     SECTION    1,CODE_C
  43. tus
  44.  
  45.  
  46.     move.l    ($4).w,a6
  47.     sub.l    a1,a1
  48.     jsr    -$126(a6)        ;findtask
  49.     move.l    d0,curtsk
  50.     move.l    d0,a0
  51.     move.l    $b8(a0),tskpri
  52.  
  53.     lea    dosnam,a1        ;doslib openen
  54.     moveq.l    #0,d0
  55.     move.l    (4).w,a6
  56.     jsr    -408(a6)        ;openlib
  57.     move.l    d0,doslib
  58.  
  59.     bsr.s    label5            ;videotracker opstarten
  60.     
  61.     move.l    curtsk,a0
  62.     move.l    tskpri,$b8(a0)
  63.     move.l    ($4).w,a6
  64.     jsr    -$84(a6)        ;forbid
  65.  
  66.     move.l    doslib,a1
  67.     move.l    (4).w,a6
  68.     jsr    -414(a6)        ;closelib
  69.  
  70.     moveq.l    #0,d0
  71.     rts
  72.     
  73. label5
  74.     move.l    (4).w,a6        ;workbench gedoe
  75.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  76.  
  77.     cmp.b    #50,ntscmode        ;ntsc ?
  78.     beq.s    str.ntsc
  79.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  80. str.ntsc
  81.  
  82.     move.l    (4).w,a6        ;68030 cache off 
  83.     jsr    -120(a6)
  84.  
  85.     btst.b    #1,297(a6)
  86.     beq.s    str.nfc
  87.     lea.l    str.ft,a5
  88.     jsr    -30(a6)
  89. str.nfc
  90.     jsr    -126(a6)
  91.     bra.s    str.fc
  92.     
  93. str.ft
  94.     dc.w    $4e7a,2
  95.     bclr    #0,d0
  96.     bset    #13,d0
  97.     dc.w    $4e7b,2
  98.     rte
  99. str.fc
  100.  
  101.     lea    cprjmp,a2        ;copjmp zetten !
  102.     move.l    #cprbck-8,d0
  103.     move.w    d0,6(a2)
  104.     swap    d0
  105.     move.w    d0,2(a2)
  106.  
  107.     lea    cprbck-8,a2        ;copstr zetten !
  108.     move.l    #cpr,d0
  109.     move.w    d0,6(a2)
  110.     swap    d0
  111.     move.w    d0,2(a2)
  112.  
  113.     bsr    cprsprrem        ;sprites legen
  114.  
  115.     lea    gfxnam,a1        ;graphics lib openen
  116.     move.l    (4).w,a6
  117.     jsr    -408(a6)        ;openlib
  118.     move.l    d0,a6
  119.     move.l    d0,gfxlib
  120.     move.l    38(a6),oldcprlist
  121.  
  122.     bset    #1,$bfe001
  123.     bsr    copbuf            ;copper vullen
  124.  
  125.     bsr    sysoff
  126.  
  127. gadrun
  128.     btst    #6,($bfe001).l
  129.     bne    gadrun
  130.  
  131. scrend
  132. scrend.play
  133.     bsr    syson
  134.  
  135.     move.l    gfxlib,a1
  136.     move.l    (4).w,a6
  137.     jsr    -414(a6)        ;closelib
  138.  
  139. scrend.qb
  140.     moveq.l    #0,d0    
  141.     rts
  142.     
  143.     ;vertical blank interrupt, no blits.
  144.     ;handles counters,interlace,sprite
  145.     ;level 3
  146.  
  147. intvb
  148.     bra.s    intvb.cnt
  149.     dc.l    'VIDU'
  150.     dc.l    'LOOP'
  151. intvb.cnt
  152.     movem.l    d0-d7/a0-a6,-(sp)
  153.     lea    ($dff000).l,a6
  154.  
  155.     move.w    $01e(a6),d0
  156.     btst    #5,d0            ;vblank ?
  157.     bne.s    intvb.vb
  158.  
  159.     bra.s    intcop.end
  160.  
  161. intvb.vb
  162.     bsr    grap
  163.     bsr    palctr            ;palette zetten
  164.     bsr.s    copbuf            ;copper vullen
  165.     
  166. intvb.end
  167.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  168.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  169.     rte
  170.  
  171. intcop.end
  172.     movem.l    (sp)+,d0-d7/a0-a6
  173.     move.l    intvbold,-(sp)
  174.     rts
  175.  
  176.     ;transmission buffer empty routine, BLIT !
  177.     ;handles routines,animations
  178.     
  179. inttbe                    ;tbe interrupt
  180.     movem.l    d0-d7/a0-a6,-(sp)
  181.     lea    ($dff000).l,a6
  182.  
  183.     move.w    $01e(a6),d0
  184.     btst    #0,d0            ;no tbe ?
  185.     beq.s    intdskblk
  186.  
  187.  
  188.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  189.     beq.s    inttbe.cop
  190.     btst    #2,($dff016).l
  191.     beq.s    inttbe.cop
  192.  
  193.     ifd    debug
  194.     move.w    #$700,$dff180
  195.     endc
  196.     
  197.     bsr    rotply            ;routineplayer BLIT !
  198.     bsr.s    copbuf            ;copper vullen
  199.  
  200.     ifd    debug
  201.     move.w    #$070,$dff180
  202.     endc
  203.     
  204. inttbe.cop
  205.  
  206. inttbe.end
  207.     move.w    #$0001,$09c(a6)
  208.     movem.l    (sp)+,d0-d7/a0-a6
  209.     rte
  210.  
  211. intdskblk
  212.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  213.     movem.l    (sp)+,d0-d7/a0-a6
  214.     move.l    inttbeold,-(sp)
  215.     rts
  216.  
  217.  
  218.     ;moves the copperbuffer to the copperlist
  219.     ;sort of double buffering
  220.     
  221. copbuf
  222.     movem.l    d0-d7/a0-a6,-(sp)
  223.  
  224.     lea    ($dff000).l,a6
  225.  
  226. copbuf.novb                ;copperchange overslaan
  227.     moveq.l    #0,d0
  228.     move.b    $005(a6),d0
  229.     lsl.w    #8,d0
  230.     moveq.l    #0,d1
  231.     move.b    $006(a6),d1
  232.     add.w    d1,d0
  233.  
  234.     cmp.w    #$4,d0
  235.     blt    copbuf.novb
  236.  
  237.     cmp.b    #50,ntscmode
  238.     beq.s    copbuf.pal
  239.     cmp.w    #$133-56-8,d0        ;ntsc grens
  240.     bge    copbuf.novb
  241.     bra.s    copbuf.cont
  242. copbuf.pal
  243.     cmp.w    #$133-8,d0        ;pal grens
  244.     bge    copbuf.novb
  245. copbuf.cont
  246.  
  247.     lea    gra.s,a0        ;buffer copieren
  248.     lea    cprbuf,a1
  249.  
  250.     move.w    00*4+2(a0),00*4+2(a1)
  251.     move.w    01*4+2(a0),01*4+2(a1)
  252.     move.w    02*4+2(a0),02*4+2(a1)
  253.     move.w    03*4+2(a0),03*4+2(a1)
  254.     move.w    04*4+2(a0),04*4+2(a1)
  255.     move.w    05*4+2(a0),05*4+2(a1)
  256.     move.w    06*4+2(a0),06*4+2(a1)
  257.     move.w    07*4+2(a0),07*4+2(a1)
  258.     move.w    08*4+2(a0),08*4+2(a1)
  259.     move.w    09*4+2(a0),09*4+2(a1)
  260.  
  261.     move.w    10*4+2(a0),10*4+2(a1)
  262.     move.w    11*4+2(a0),11*4+2(a1)
  263.     move.w    12*4+2(a0),12*4+2(a1)
  264.     move.w    13*4+2(a0),13*4+2(a1)
  265.     move.w    14*4+2(a0),14*4+2(a1)
  266.     move.w    15*4+2(a0),15*4+2(a1)
  267.     move.w    16*4+2(a0),16*4+2(a1)
  268.     move.w    17*4+2(a0),17*4+2(a1)
  269.     move.w    18*4+2(a0),18*4+2(a1)
  270.     move.w    19*4+2(a0),19*4+2(a1)
  271.  
  272.     move.w    20*4+2(a0),20*4+2(a1)
  273.     move.w    21*4+2(a0),21*4+2(a1)
  274.     move.w    22*4+2(a0),22*4+2(a1)
  275.     move.w    23*4+2(a0),23*4+2(a1)
  276.     move.w    24*4+2(a0),24*4+2(a1)
  277.     move.w    25*4+2(a0),25*4+2(a1)
  278.     move.w    26*4+2(a0),26*4+2(a1)
  279.     move.w    27*4+2(a0),27*4+2(a1)
  280.     move.w    28*4+2(a0),28*4+2(a1)
  281.     move.w    29*4+2(a0),29*4+2(a1)
  282.  
  283.     move.w    30*4+2(a0),30*4+2(a1)
  284.     move.w    31*4+2(a0),31*4+2(a1)
  285.     move.w    32*4+2(a0),32*4+2(a1)
  286.     move.w    33*4+2(a0),33*4+2(a1)
  287.     move.w    34*4+2(a0),34*4+2(a1)
  288.     move.w    35*4+2(a0),35*4+2(a1)
  289.     move.w    36*4+2(a0),36*4+2(a1)
  290.     move.w    37*4+2(a0),37*4+2(a1)
  291.     move.w    38*4+2(a0),38*4+2(a1)
  292.     move.w    39*4+2(a0),39*4+2(a1)
  293.  
  294.     move.w    40*4+2(a0),40*4+2(a1)
  295.     move.w    41*4+2(a0),41*4+2(a1)
  296.     move.w    42*4+2(a0),42*4+2(a1)
  297.     move.w    43*4+2(a0),43*4+2(a1)
  298.     move.w    44*4+2(a0),44*4+2(a1)
  299.     move.w    45*4+2(a0),45*4+2(a1)
  300.     move.w    46*4+2(a0),46*4+2(a1)
  301.     move.w    47*4+2(a0),47*4+2(a1)
  302.     move.w    48*4+2(a0),48*4+2(a1)
  303.     move.w    49*4+2(a0),49*4+2(a1)
  304.  
  305.     move.w    50*4+2(a0),50*4+2(a1)
  306.     move.w    51*4+2(a0),51*4+2(a1)
  307.     move.w    52*4+2(a0),52*4+2(a1)
  308.     move.w    53*4+2(a0),53*4+2(a1)
  309.     move.w    54*4+2(a0),54*4+2(a1)
  310.  
  311. copbuf.end
  312.     movem.l    (sp)+,d0-d7/a0-a6
  313.     rts
  314.  
  315.     ;goes back to the workbench
  316.     
  317. syson
  318.     movem.l    d0-d7/a0-a6,-(sp)
  319.  
  320.     move.w    #$0001,$dff09a        ;tbeint uit
  321.     move.l    intvbold,($6c).w
  322.     move.l    inttbeold,($64).w
  323.  
  324.     move.l    4,a6
  325.     jsr    -138(a6)        ;permit
  326.  
  327.     move.l    gfxlib,a6
  328.     jsr    -462(a6)        ;disownblitter
  329.  
  330.     move.l    wbview,a1
  331.     move.l    gfxlib,a6
  332.     jsr    _LVOLoadView(a6)     ; Fix view
  333.     jsr    _LVOWaitTOF(a6)
  334.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  335.  
  336. syson.ras
  337.     cmp.b    #$c0,$dff006        ;prevent copperjump
  338.     bne    syson.ras
  339.  
  340.     move.l    gfxlib,a6
  341.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  342.  
  343.     movem.l    (sp)+,d0-d7/a0-a6
  344.     rts
  345.     
  346.     ;goes back to the gadgetscreen
  347.     
  348. sysoff
  349.     movem.l    d0-d7/a0-a6,-(sp)
  350.      
  351.     move.l    gfxlib,a6
  352.     move.l    gb_ActiView(a6),wbview    ;current view
  353.     sub.l    a1,a1            ; clear a1
  354.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  355.     jsr    _LVOWaitTOF(a6)     ; Wait once
  356.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  357.  
  358.     move.l    gfxlib,a6
  359.     jsr    -456(a6)        ;ownblitter
  360.  
  361.     move.l    4,a6
  362.     jsr    -132(a6)        ;forbid
  363.         
  364.     move.l    ($6c).w,intvbold
  365.     move.l    #intvb,($6c).w
  366.     move.l    ($64).w,inttbeold
  367.     move.l    #inttbe,($64).w
  368.     move.w    #$8001,$dff09a        ;tbeint aan
  369.     bsr    gracpr            ;reset copper
  370.     bsr    copbuf            ;copy copper
  371.     move.l    #cpr,$dff080
  372.  
  373.     movem.l    (sp)+,d0-d7/a0-a6
  374.     rts
  375.     
  376. cprsprrem
  377.     movem.l    d0-d7/a0-a6,-(sp)
  378.     lea    cprspr,a0
  379.     move.l    #sprdat,d0
  380.     move.w    #7,d1
  381. cprsprrem.a
  382.     move.w    d0,3*2(a0)
  383.     swap    d0
  384.     move.w    d0,1*2(a0)
  385.     swap    d0
  386.     add.l    #8,a0
  387.     dbra    d1,cprsprrem.a
  388.     movem.l    (sp)+,d0-d7/a0-a6
  389.     rts
  390.  
  391. varset                    ;variablen neerzetten
  392.     movem.l    d0-d7/a0-a6,-(sp)
  393.     move.l    #var,a0
  394.  
  395.     move.l    #cprbck,var_cprbck(a0)
  396.     move.l    gfxlib,var__GfxBase(a0)
  397.     move.b    ntscmode,var_ntsc(a0)
  398.  
  399.     move.l    curpic1,var_pic1(a0)    ;variabel
  400.     move.l    curpic2,var_pic2(a0)    ;variabel
  401.     move.w    anispd1,var_anispd1(a0)
  402.     move.w    anitel1,var_anitel1(a0)
  403.     movem.l    (sp)+,d0-d7/a0-a6
  404.     rts
  405.     
  406.     ;this routine handles all videotracker-routines
  407.  
  408. rotply    
  409.     movem.l    d0-d7/a0-a6,-(sp)
  410.  
  411.     moveq.l    #0,d0
  412.  
  413.     lea    currot1,a2        ;routine 1
  414.     move.w    rotinf1,d0        ;routine info
  415.     bsr.s    rotplyr
  416.  
  417. rotply.end
  418.     movem.l    (sp)+,d0-d7/a0-a6
  419.     rts
  420.  
  421.     ;this routine handles 1 routine, BLIT !
  422.     
  423. rotplyr
  424.     movem.l    d0-d7/a1-a6,-(sp)
  425.  
  426.     move.l    #rot,(a2)        ;routinestart address
  427.  
  428.     move.b    #50,ntscmode        ;ntsc/pal hz
  429.     move.l    #rotincpic,curpic1    ;incbinfile !!!
  430.     clr.l    curpic2            ;background picture
  431.     move.w    #1,anispd1        ;animationspeed
  432.     c